//
//  MarkListTableViewCell.m
//  Founder_study
//
//  Created by hongbao.cui on 14-8-21.
//  Copyright (c) 2014年 com.founder. All rights reserved.
//

#import "MarkListTableViewCell.h"
#import "ApplicationUtils.h"
@implementation MarkListTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        NSInteger off=10;
        UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10+off, 5, FMSCREENWIDTH-20, 20)];
        [nameLabel setText:@"酷虎编号:"];
        [nameLabel setBackgroundColor:[UIColor clearColor]];
        //        [nameLabel setAutoresizesSubviews:YES];
        //        [nameLabel setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleBottomMargin|UIViewAutoresizingFlexibleTopMargin];
        [nameLabel setBackgroundColor:[UIColor clearColor]];
        [nameLabel setFont:[UIFont systemFontOfSize:16]];
        [nameLabel setNumberOfLines:0];
        [nameLabel setLineBreakMode:NSLineBreakByWordWrapping];
        [nameLabel setTag:100];
        [self.contentView addSubview:nameLabel];
        
        UILabel *scroeLabel = [[UILabel alloc] initWithFrame:CGRectMake(10+off, 27, 200, 15)];
        [scroeLabel setBackgroundColor:[UIColor clearColor]];
        [scroeLabel setText:@"120"];
        [scroeLabel setTextColor:[UIColor grayColor]];
        [scroeLabel setFont:[UIFont systemFontOfSize:14]];
        [scroeLabel setNumberOfLines:0];
        [scroeLabel setLineBreakMode:NSLineBreakByWordWrapping];
        [scroeLabel setTag:101];
        [self.contentView addSubview:scroeLabel];
        
        UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(10+off, 44, 200, 15)];
        [timeLabel setBackgroundColor:[UIColor clearColor]];
        [timeLabel setTextColor:[UIColor grayColor]];
        [timeLabel setText:@"2013-06-29 12:18"];
        [timeLabel setFont:[UIFont systemFontOfSize:14]];
        [timeLabel setNumberOfLines:0];
        [timeLabel setLineBreakMode:NSLineBreakByWordWrapping];
        [timeLabel setTag:102];
        [self.contentView addSubview:timeLabel];
        
        UILabel *getScroeLabel = [[UILabel alloc] initWithFrame:CGRectMake(210+off, 44,100, 15)];
        [getScroeLabel setBackgroundColor:[UIColor clearColor]];
        [getScroeLabel setTextColor:[UIColor grayColor]];
        [getScroeLabel setText:@"2"];
        [getScroeLabel setFont:[UIFont systemFontOfSize:14]];
        [getScroeLabel setNumberOfLines:0];
        [getScroeLabel setLineBreakMode:NSLineBreakByWordWrapping];
        [getScroeLabel setTag:103];
        [self.contentView addSubview:getScroeLabel];
        //        cell.imageView.image = [ApplicationInfo getImageFromLocalFile:@"paper_list_right_arrow"];
        //        cell.indentationLevel = 27;
        [self setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
        UIImageView *bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 50)];
        [bgImageView setImage:[ApplicationUtils getLocalImage:@"selector_lib_item_bg"]];
        self.selectedBackgroundView = bgImageView;
    }
    return self;
}

- (void)awakeFromNib
{
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)setData:(NSDictionary *)dataDict{
    UILabel  *nameLabel = (UILabel *)[self.contentView viewWithTag:100];
    if (nameLabel!=nil) {
        [nameLabel setText:[dataDict objectForKey:@"paper_title"]];
    }
    //        NSDictionary *countScroeDict = [Sqlite selectQuestionRightCount];
    NSInteger count= [[dataDict objectForKey:@"exam_score"] integerValue];
    NSInteger num = [[dataDict objectForKey:@"paper_score"] integerValue];
    NSInteger countQuestion = [[dataDict objectForKey:@"qst_count"] integerValue];
    int everScore = num/countQuestion;
    NSString *scroeStr = [NSString stringWithFormat:@"%d",count];
    UILabel  *scroeLabel = (UILabel *)[self.contentView viewWithTag:101];
    if (scroeLabel!=nil) {
        NSString *formateS = [NSString stringWithFormat:@"测试总分值:%@",[dataDict objectForKey:@"paper_score"]];
        [scroeLabel setText:formateS];
    }
    UILabel  *timeLabel = (UILabel *)[self.contentView viewWithTag:102];
    if (timeLabel!=nil) {
        NSString *formateT = [NSString stringWithFormat:@"测试时间:%@",[dataDict objectForKey:@"exam_time"]];
        [timeLabel setText:formateT];
    }
    UILabel  *getScroeLabel = (UILabel *)[self.contentView viewWithTag:103];
    if (getScroeLabel!=nil) {
        NSString *formatess = [NSString stringWithFormat:@"得分:%@",scroeStr];
        [getScroeLabel setText:formatess];
    }
}
@end
